﻿using Schedulr.Extensibility;
using Schedulr.Providers;

namespace Schedulr.Plugins.ImportMetadata
{
    [Plugin("Import Metadata", "Automatically retrieve metadata when pictures are added", "Imports picture metadata (such as the title, description, tags, geographic location) from a picture (not video) when it is added.", InstantiationPolicy = PluginInstantiationPolicy.SingleInstancePerScope)]
    [SupportedPictureEvent(PictureEventType.Adding)]
    public class ImportMetadataPlugin : EventPlugin
    {
        public override void OnPictureEvent(PictureEventArgs args)
        {
            if (!args.IsVideo)
            {
                PictureMetadataProvider.RetrieveMetadataFromFile(args.Picture.FileName, args.Picture, this.Host.Logger);
            }
        }
    }
}